package ast.exp;

import icg.EQIdent;
import ts.Info;
import ast.Node;
import ast.type.Type;

public class IdExp extends Expression {
	private Integer id;

	public IdExp(Integer id) {
		this.id = id;
	}

	public void setType(Type t) {
		this.type = t;
	}

	@Override
	public Type typeCheck() {
		Info i = Node.st.getInfo(id);
		type = i.getType();
		return type;
	}

	@Override
	public String toString() {
		return "<IdExp id=\"" + id + "\" type=\"" + type + "\" />";
	}

	@Override
	public void genCode() {
		this.addr = new EQIdent(id.toString());
	}
}
